package user;

import operation.IOperation;
import operation.impl.BorrowOperation;
import operation.impl.DisplayOperation;
import operation.impl.FindOperation;
import operation.impl.ReturnOperation;

//普通用户类
public class NormalUser extends User{
    /**
     * 1.显示当前书籍列表
     * 2.查询书籍
     * 3.借阅书籍
     * 4.归还图书
     * -1.退出
     */
    public NormalUser(String userName) {
        super();
        this.name = userName;
        operations = new IOperation[]{
                new DisplayOperation(),
                new FindOperation(),
                new BorrowOperation(),
                new ReturnOperation()
        };
    }

    @Override
    public int menu() {
        System.out.println("======================================");
        System.out.println("欢迎"+this.name+"登录财大图书馆管理系统");
        System.out.println("1.显示当前书籍列表");
        System.out.println("2.查询书籍");
        System.out.println("3.借阅书籍");
        System.out.println("4.归还书籍");
        System.out.println("-1.退出");
        System.out.println("请输入您的选择:");
        int choice = scanner.nextInt();
        // 切记不要在这关闭scanner，当用户输入-1退出时再关闭scanner
        return choice;
    }
}
